﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;

namespace ConsoleApplication1
{
    class Program
    {
        // ----------------------------------------------------- Main-Methode ----------------------------------------------------
        static void Main()
        {
            Connector connector = new Connector();

            //Dictionary<int, Player> playaZ = new Dictionary<int, Player>();
            //Player p1 = new Player(1, 15, 2, "Player1", true, 10);
            //Player p2 = new Player(2, 17, 9, "Player2", true, 110);
            //Player p3 = new Player(3, 30, 7, "Player3", true, 15);
            //Player p4 = new Player(4, 11, 10, "Player4", false, 20);
            //Player p5 = new Player(5, 1, 14, "Player5", true, 30);
            //Player p6 = new Player(6, 9, 1, "Player6", false, 410);
            //Player p7 = new Player(7, 1, 1, "Player7", false, 130);
            //Player p8 = new Player(8, 2, 7, "Player8", true, 2320);
            //Player p9 = new Player(9, 20, 20, "Player9", false, 2230);
            //Player p10 = new Player(10, 1, 16, "Player10", true, 0);

            //playaZ.Add(p3.Id, p3);
            //playaZ.Add(p10.Id, p10);
            //playaZ.Add(p5.Id, p5);
            //playaZ.Add(p4.Id, p4);
            //playaZ.Add(p7.Id, p7);
            //playaZ.Add(p6.Id, p6);
            //playaZ.Add(p1.Id, p1);
            //playaZ.Add(p9.Id, p9);
            //playaZ.Add(p2.Id, p2);
            //playaZ.Add(p8.Id, p8);


            //List<Player> playerlist = new List<Player>();
            //playerlist = playaZ.Values.ToList();

            //Console.WriteLine("////// UNSORTIERT");
            //playerlist.ForEach(delegate(Player name)
            //{
            //    Console.WriteLine("Name: " + name.Description + "  Id: " + name.Id + "  Points: " + name.Points + " xPos: " + name.X + " yPos: " + name.Y);
            //});
            //Console.WriteLine();

    
          


            // LinearSearch
            //Player p = new LinearSearch<Player>().find(playerlist, (i) => i.Description.Equals("Player6"));
            //Console.WriteLine(p.Description);
            //Player p = new LinearSearch<Player>().find(playerlist, (i) => i.Busy == true);
            //Console.WriteLine(p.Description + " Busy: " + p.Busy);

            //int startX = 2;
            //int startY = 12;
            //Player p = new LinearSearch<Player>().find(playerlist, (i) => (Math.Abs((startX - i.X)) + Math.Abs((startY - i.Y))) <= 20);
            //Console.WriteLine("Startposition: " + startX + " " + startY);
            //if (p != null) Console.WriteLine(p.Description + " Felder entfernt: " + (Math.Abs((startX - p.X)) + Math.Abs((startY - p.Y))));

            //Quicksort
            //playerlist = new Quicksort<Player>().sort(playerlist, 0, (playerlist.Count() - 1), (c1,c2) => c1.Description.CompareTo(c2.Description));
            //playerlist = new Quicksort<Player>().sort(playerlist, 0, (playerlist.Count() - 1), (c) => c.Id);
             //playerlist = new Quicksort<Player>().sort(playerlist, 0, (playerlist.Count() - 1), (c) => c.Points);

            // BinarySearch
            //Player p = new BinarySearch<Player>().find(playerlist, (i) => i.Description.CompareTo("Player7"));
            //Console.WriteLine(p.Description);

             //Player p = new BinarySearch<Player>().find(playerlist, (i) => i.Points.CompareTo(110));
             //Console.WriteLine(p.Description + " Points: " + p.Points);

           

            

           


            //Console.WriteLine("////// SORTIERT");
            //playerlist.ForEach(delegate(Player name)
            //{
            //    Console.WriteLine("Name: " + name.Description + "  Id: " + name.Id + "  Points: " + name.Points);
            //});
    
            //Console.ReadLine();
        }
    }
}
